"use strict";
Object.defineProperties(exports, {__esModule: {value: !0}, [Symbol.toStringTag]: {value: "Module"}});

class n {
    weight = [];
    start = 2;
    isAscii;
    finish = !1;
    startIndex = 0;
    static MAX_POTOCOL_LENGTH = 30;

    constructor(t) {
        this.isAscii = t
    }

    add(t) {
        this.isAscii && t < 0 || this.finish || (t === this.start ? this.weight[0] === this.start ? this.finish = !0 : this.weight = [t] : this.weight.length > n.MAX_POTOCOL_LENGTH ? this.weight = [t] : this.weight.push(t))
    }

    isComplete() {
        return this.finish
    }

    parseWeight() {
        const t = Number(this.doParseWeight(this.weight.filter(e => e !== this.start)));
        return this.weight = [], this.finish = !1, t
    }
}

class u extends n {
    constructor() {
        super(!0)
    }

    doParseWeight(t) {
        const e = Number.parseInt(String.fromCodePoint(t[9])), r = t.map(s => String.fromCodePoint(s)).slice(2, 9);
        return r.splice(r.length - e, 0, "."), r.join("")
    }

    get name() {
        return "顶松1705通讯方式(6)"
    }
}

class c extends n {
    constructor() {
        super(!0)
    }

    doParseWeight(t) {
        return String.fromCodePoint(...t.slice(0, 7)).trim()
    }

    get name() {
        return "HBM通用协议"
    }
}

class l extends n {
    constructor() {
        super(!1), this.start = -1
    }

    doParseWeight(t) {
        const e = t[0].toString(16);
        return (e === "31" || e === "21" ? "-" : "+") + t[t.length - 1].toString(16) + t[t.length - 1 - 1].toString(16) + t[t.length - 1 - 1 - 1].toString(16)
    }

    get name() {
        return "恒天通用协议"
    }
}

class a extends n {
    constructor() {
        super(!0)
    }

    doParseWeight(t) {
        const e = this.parseDigitsPosition(t[0]), r = this.parseNegative(t[1]),
            s = t.slice(3, 9).map(i => String.fromCodePoint(i));
        return s.unshift(r), s.splice(s.length - e, 0, "."), s.join("")
    }

    parseDigitsPosition(t) {
        const e = t.toString(2), r = [-1, -1, -1];
        e.length >= 3 ? (r[0] = Number.parseInt(e.slice(-1, e.length)), r[1] = Number.parseInt(e.slice(-2, -1)), r[2] = Number.parseInt(e.slice(-3, -2))) : e.length == 2 ? (r[0] = Number.parseInt(e.slice(-1, e.length)), r[1] = Number.parseInt(e.slice(-2, -1)), r[2] = 0) : e.length == 1 && (r[0] = Number.parseInt(e.slice(-1, e.length)), r[1] = 0, r[2] = 0);
        const s = r.map(i => i.toString()).join();
        return s == "110" ? 1 : s == "001" ? 2 : s == "101" ? 3 : s == "011" ? 4 : s == "111" ? 5 : 0
    }

    parseNegative(t) {
        const e = t.toString(2);
        return e.length >= 2 && e.slice(-2, -1) == "1" ? "-" : ""
    }

    get name() {
        return "托利多协议"
    }
}

class g extends n {
    constructor() {
        super(!0), this.start = 10
    }

    doParseWeight(t) {
        return String.fromCodePoint(...t.slice(6, 14)).split(" ").join("")
    }

    get name() {
        return "金钟XK3102K"
    }
}

class h extends n {
    constructor() {
        super(!0)
    }

    doParseWeight(t) {
        const e = t.filter(i => i !== 2 && i !== 3 && i !== 255), r = Number.parseInt(String.fromCodePoint(e[7])),
            s = e.slice(0, 7).map(i => String.fromCharCode(i));
        return s.splice(s.length - r, 0, "."), s.join("")
    }

    get name() {
        return "耀华通用协议"
    }
}

class m extends n {
    constructor() {
        super(!0), this.start = 61
    }

    doParseWeight(t) {
        return t.reverse(), String.fromCodePoint(...t)
    }

    get name() {
        return "耀华XK3190-A9"
    }
}

const f = {
    DS_1705Protocol: u,
    HBMWeightProtocol: c,
    HTWeightProtocol: l,
    TLDWeightProtocol: a,
    XK3102K: g,
    YaoWeightProtocol: h,
    YaoXk3190A9: m
};
exports.default = f;
